package com.starleague.battletech.unit;

import com.starleague.battletech.IBattletechPoints;

public interface IBattletechUnitHitLocation
{
    IBattletechPoints getArmorHitPoints();

    IBattletechPoints getInternalStructureHitPoints();

    // int findUnusedCriticalSlot(); // returns -1 if it is full
    // boolean addCriticalSlot(final ICriticalSlot i_criticalSlot) throws LocationFullException;
    // boolean setCriticalSlot(final ICriticalSlot i_criticalSlot, final int i_hitLocationIndex) throws
    // SlotOccupiedException;
    // boolean removeCriticalSlot(final ICriticalSlot i_criticalSlot);
    // // void removeAllCriticalSlots(final IComponent i_component);
    //
    // // void takeDamage(final int i_damage, final int i_numCriticals);
    //
    // static class LocationFullException extends StarLeagueException
    // {
    // private static final long serialVersionUID = 1L;
    //
    // LocationFullException(final IHitLocation i_hitLocation)
    // {
    // super("LocationFullException: " + i_hitLocation);
    // }
    // }
    //
    // static class SlotOccupiedException extends StarLeagueException
    // {
    // private static final long serialVersionUID = 1L;
    //
    // SlotOccupiedException(final IHitLocation i_hitLocation, final int i_hitLocationIndex)
    // {
    // super("SlotOccupiedException: " + i_hitLocation + " index [" + i_hitLocationIndex + "]");
    // }
    // }
}

// int getCurrentInternalStructurePoints() { return this.currentInternalStructurePoints; }
// int getMaximumInternalStructurePoints() { return this.max_internal_structure_points; }
//
// int getCurrentArmorPoints() { return this.current_armor_points; }
// int getMaximumArmorPoints() { return this.max_armor_points; }
//
// abstract int getCurrentInternalStructurePoints();
// abstract int getMaximumInternalStructurePoints();
//
// abstract int getCurrentArmorPoints();
// abstract int getMaximumArmorPoints();

// protected HitLocation(final int i_numCriticalSlots)
// {
// this.numCriticalSlots = i_numCriticalSlots;
//
// // TODO: populate armor/IS
// //_armor_map = new EnumMap<HitLocation.FACING, Integer>(HitLocation.FACING.class);
// //for (HitLocation.FACING armor_facing : HitLocation.FACING.values())
// // _armor_map.put(armor_facing, 0);
//
// this.criticalSlots = new ICriticalSlot[this.numCriticalSlots]; // initial capacity
// //new ArrayList<HitLocation.ICriticalSlot>(_type.num_critical_slots); // initial capacity
// for (int i = 0;i < this.criticalSlots.length;++i)
// this.criticalSlots[i] = null;
// }
//
// //
// //
// //
//
// protected HitLocation() {}
//
// private int numCriticalSlots;
//
// @Transient
// private ICriticalSlot criticalSlots[];
// //private final ArrayList<HitLocation.ICriticalSlot> _critical_slot_list;
//
// static interface Placement
// {
// final class Anywhere implements HitLocation.Placement {}
// }

// int getCurrentInternalStructurePoints() { return this.current_internal_structure_points; }
// int getMaximumInternalStructurePoints() { return this.max_internal_structure_points; }

// int getCurrentArmorPoints() { return this.current_armor_points; }
// int getMaximumArmorPoints() { return this.max_armor_points; }

//
// protected boolean addCriticalSlot(final ICriticalSlot i_critical_slot, final int i_num_slots)
// {
// if (i_critical_slot == null)
// return false;
//
// if (getNumFreeSlots() < i_num_slots)
// return false; // Not enough room
//
// for (int i = 0;i < i_num_slots; ++i)
// for (int slot_indx = 0;slot_indx < this.critical_slot_array.length; ++slot_indx)
// if (this.critical_slot_array[slot_indx] == null)
// {
// this.critical_slot_array[slot_indx] = i_critical_slot;
// break;
// }
//
// return true;
// }
//
// protected boolean removeCriticalSlot(final ICriticalSlot i_critical_slot)
// {
// if (i_critical_slot == null)
// return false;
//
// boolean found = false;
//
// for (int i = 0;i < this.critical_slot_array.length; ++i)
// if (this.critical_slot_array[i] == i_critical_slot)
// {
// this.critical_slot_array[i] = null;
// found = true;
// }
//
// return found;
// }
//
// int getNumFreeSlots()
// {
// int free_count = 0;
// for (ICriticalSlot slot : this.critical_slot_array)
// if (slot == null)
// ++free_count;
// return free_count;
// }
//
// int getNumAnywhereSlots()
// {
// int anywhere_count = 0;
// for (ICriticalSlot slot : this.critical_slot_array)
// if (slot instanceof ICriticalSlot.Anywhere)
// ++anywhere_count;
// return anywhere_count;
// }
//
// Set<ICriticalSlot.Anywhere> removeAllAnywhereSlots()
// {
// Set<ICriticalSlot.Anywhere> anywhere_set = new HashSet<ICriticalSlot.Anywhere>();
// for (int i = 0; i < this.critical_slot_array.length; ++i)
// if (this.critical_slot_array[i] instanceof ICriticalSlot.Anywhere)
// {
// anywhere_set.add((ICriticalSlot.Anywhere)this.critical_slot_array[i]);
// this.critical_slot_array[i] = null;
// }
// return anywhere_set;
// }
//
// protected final ICriticalSlot[] getCriticalSlots()
// {
// return this.critical_slot_array;
// }
//
// //
// //
// //
//
// // // Required to populate this.hex_array_2d[][] after it is loaded from the DB
// // protected static class PersistHandler
// // {
// // @PostLoad
// // void OnPostLoad(HitLocation hit_location) throws Error // Can ONLY throw 'Error', not Exceptions
// // {
// // hit_location.critical_slot_array = new ICriticalSlot[hit_location.num_critical_slots];
// // for (int i = 0;i < hit_location.critical_slot_array.length;++i)
// // hit_location.critical_slot_array[i] = null;
// // }
// //
// // PersistHandler() {}
// // }
//

//
// /*
// final int getArmor(final HitLocation.FACING i_facing)
// {
// if (_armor_map.containsKey(i_facing))
// return _armor_map.get(i_facing);
// return 0;
// }
// */
//
// //
// //
// //
//
// // private final EnumMap<HitLocation.FACING, Integer> _armor_map;
// // final HitLocation.TYPE _type;
// // protected HitLocation(final HitLocation.TYPE i_type,
// // final battletech.mech.InternalStructure i_internal_structure,
// // final int i_armor_points)
// // throws BattletechException
// // {
// // _internal_structure_points = i_internal_structure.getPointsInHitLocation(i_type);
// //
// //// if (i_armor_points > _internal_structure_points)
// //// throw new BattletechException(
// //// "Armor points [" + i_armor_points + "] cannot exceed Internal Structure points * 2 [" +
// //// (_internal_structure_points * 2) + "]");
// //
// // //_type = i_type;
// // _armor_points = i_armor_points;
// //
// // // TODO: populate armor/IS
// // //_armor_map = new EnumMap<HitLocation.FACING, Integer>(HitLocation.FACING.class);
// // //for (HitLocation.FACING armor_facing : HitLocation.FACING.values())
// // // _armor_map.put(armor_facing, 0);
// //
// // //_internal_structure = 0;
// //
// // _critical_slot_list =
// // new ICriticalSlotable[i_type.num_critical_slots]; // initial capacity
// // //new ArrayList<HitLocation.ICriticalSlot>(_type.num_critical_slots); // initial capacity
// // for (int i = 0;i < i_type.num_critical_slots;++i)
// // _critical_slot_list[i] = null;
// // }
// // protected HitLocation(
// // final SerialObject.SerialManager i_sobject_manager,
// // final HitLocation.SerialData i_hit_location_data)// throws BattletechException
// // {
// // _type = i_hit_location_data.type;
// // _internal_structure_points = i_hit_location_data.internal_structure_points;
// // _armor_points = i_hit_location_data.armor_points;
//
// // TODO: populate armor/IS
// //_armor_map = new EnumMap<HitLocation.FACING, Integer>(HitLocation.FACING.class);
// //for (HitLocation.FACING armor_facing : HitLocation.FACING.values())
// // _armor_map.put(armor_facing, 0);
//
// //_current_internal_structure = 0;
//
// _critical_slot_list = new ICriticalSlotable[i_hit_location_data._serial_id_array.length];
//
// for (int i = 0;i < i_hit_location_data._serial_id_array.length; ++i)
// {
// _critical_slot_list[i] =
// (ICriticalSlotable)i_sobject_manager.getSerialObject(i_hit_location_data._serial_id_array[i]);
// }
// //
// // //new ArrayList<HitLocation.ICriticalSlot>(_type.num_critical_slots); // initial capacity
// // for (int i = 0;i < _type.num_critical_slots;++i)
// // _critical_slot_list[i] = null;
// }

/*
 * void SetArmor(final HitLocation.FACING i_facing, final int i_armor) throws battletech.Exception { if (i_armor < 0)
 * throw new battletech.Exception("HitLocation.SetArmor(): i_armor [" + i_armor + "] < 0"); _armor_map.put(i_facing,
 * i_armor); }
 * 
 * void SetInternalStructure(final int i_internal_structure) throws battletech.Exception { if (i_internal_structure < 0)
 * throw new battletech.Exception( "HitLocation.SetInternalStructure(): i_internal_structure [" + i_internal_structure +
 * "] < 0"); _internal_structure = i_internal_structure; }
 */

//
//
//

/*
 * private class CriticalSlot {
 * 
 * }
 */

//
//
//

// NOTE: Mechs and vehicles will have different combinations of locations
/*
 * enum TYPE { HEAD, CENTER_TORSO, LEFT_TORSO, RIGHT_TORSO, LEFT_ARM, LEFT_LEG_FRONT, RIGHT_ARM, RIGHT_LEG_FRONT,
 * LEFT_LEG, LEFT_LEG_BACK, RIGHT_LEG, RIGHT_LEG_BACK, }
 * 
 * --
 * 
 * private static final int CRITICAL_SLOTS_HEAD = 6; private static final int CRITICAL_SLOTS_TORSO = 12; private static
 * final int CRITICAL_SLOTS_ARM = 12; private static final int CRITICAL_SLOTS_LEG = 6;
 * 
 * static enum TYPE { HEAD(CRITICAL_SLOTS_HEAD), CENTER_TORSO(CRITICAL_SLOTS_TORSO), SIDE_TORSO(CRITICAL_SLOTS_TORSO),
 * ARM(CRITICAL_SLOTS_ARM), LEG(CRITICAL_SLOTS_LEG);
 * 
 * final int num_critical_slots;
 * 
 * private TYPE(final int i_num_critical_slots) { num_critical_slots = i_num_critical_slots; } }
 */

/*
 * enum FACING { FRONT, REAR, }
 * 
 * enum SIDE { RIGHT, LEFT, }
 */

// static final String[] LOCATION_ABBRS = {"HD", "CT", "RT",
// "LT", "RA", "LA", "RL", "LL"};

// final HitLocation.TYPE getTYPE() { return _type; }
// protected static abstract class SerialData extends SerialObject.SerialData
// {
// // abstract HitLocation Deserialize(final SerialObject.SerialManager i_sobject_manager) throws
// BattletechException;
//
// final HitLocation.TYPE type;
// final int internal_structure_points;
// final int armor_points;
//
// final SerialObject.SerialID[] _serial_id_array;
// //
// // final List<SerialObject.SerialID> _serial_id_list =
// // new ArrayList<SerialObject.SerialID>();
//
// protected SerialData(final SerialObject.SerialManager i_sobject_manager, final HitLocation i_hit_location)
// {
// super(i_sobject_manager, i_hit_location);
// type = i_hit_location._type;
// internal_structure_points = i_hit_location._internal_structure_points;
// armor_points = i_hit_location._armor_points;
//
// _serial_id_array = new SerialObject.SerialID[i_hit_location.getCriticalSlotList().length];
// for(int i = 0; i < i_hit_location.getCriticalSlotList().length; ++i)
// {
// ICriticalSlotable crit_slotable = i_hit_location.getCriticalSlotList()[i];
// if (crit_slotable == null)
// _serial_id_array[i] = null;
// else
// _serial_id_array[i] = i_sobject_manager.getSerialID(crit_slotable);
// // _serial_id_list.add(i_sobject_manager.getSerialID(crit_slotable));
// }
// }
// }

